public class Triangle {
	public void Circle(double a, double b, double c) {
		setSideA(a);
		setSideB(b);
		setSideC(c);
	}

	// 边长1
	private double sideA;
	// 边长2
	private double sideB;
	// 边长3
	private double sideC;

	/**
	 * @return the sideA
	 */
	public double getSideA() {
		return sideA;
	}

	/**
	 * @param sideA
	 *            the sideA to set
	 */
	public void setSideA(double sideA) {
		if (sideA > 0) {
			this.sideA = sideA;
		} else {
			System.out.println("错误！边长应大于零。");
		}
	}

	/**
	 * @return the sideB
	 */
	public double getSideB() {
		return sideB;
	}

	/**
	 * @param sideB
	 *            the sideB to set
	 */
	public void setSideB(double sideB) {
		if (sideB > 0) {
			this.sideB = sideB;
		} else {
			System.out.println("错误！边长应大于零。");
		}
	}

	/**
	 * @return the sideC
	 */
	public double getSideC() {
		return sideC;
	}

	/**
	 * @param sideC
	 *            the sideC to set
	 */
	public void setSideC(double sideC) {
		if (sideC > 0) {
			this.sideC = sideC;
		} else {
			System.out.println("错误！边长应大于零。");
		}
	}

	private boolean invaild() {
		return sideA + sideB > sideC && sideA + sideC > sideB
				&& sideB + sideC > sideA;
	}

	// 获取三角形的面积
	public double getArea() {
		if (invaild()) {
			double p = (sideA + sideB + sideC) / 2;
			return Math.sqrt(p * (p - sideA) * (p - sideB) * (p - sideC));
		} else {
			return -1;
		}
	}

	// 获取三角形的面积
	public static double getArea(double side, double height) {
		return side * height;
	}

	// 获取三角形的周长
	public double getPerimeter() {
		if (invaild()) {
			return (sideA + sideB + sideC);
		} else {
			return -1;
		}
	}

	public void showMe() {
		System.out.println("边长为" + sideA + "," + sideB + "," + sideC + "的三角形。");
	}

}
